import Vue from 'vue'
import Vuex from 'vuex'

import getlink from "@/api/getapi.js";

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    arr1:[],
    arr2:[],
    arr3:[],
    arr4:[],
    arr5:[],
    arr6:[],
    guan:[],
    tui:[],
    hao:[],
    wen:[],
    chick1:[],
    chick2:[],
    kanguo:[],
    zhi1:[],
    zhi2:[],
    zhi3:[],
    zhi4:[],
    zhi5:[],
    zhi6:[],
  },
  mutations: {
    getdata(state,payload) {
      // 发现数据
      state.arr1 = payload.num.find.slice(0,15)
      state.arr2 = payload.num.find.slice(15,30)
      state.arr3 = payload.num.find.slice(25,40)
      state.arr4 = payload.num.shixi.slice(0,18)
      state.arr5 = payload.num.shixi.slice(15,28)
      state.arr6 = payload.num.shixi.slice(25,40)
      // 有了数据
      state.tui = payload.num.have
      state.guan = payload.num.guanzhu
      state.hao = payload.num.haowen
      state.wen = payload.num.wenda
      // 消息 聊天 chickall
      state.chick1 = payload.num.chickall
      state.chick2 = payload.num.chickall.slice(2,10)
      // 消息 互动 saw
      state.kanguo = payload.num.saw
      // 消息 互动 zhi
      state.zhi1 = payload.num.saw.slice(2,8)
      state.zhi2 = payload.num.saw.slice(3,9)
      state.zhi3 = payload.num.saw.slice(4,10)
      state.zhi4 = payload.num.saw.slice(1,7)
      state.zhi4 = payload.num.saw.slice(5,10)
      state.zhi5 = payload.num.saw.slice(6,10)
      state.zhi6 = payload.num.saw.slice(7,10)
    }
  },
  actions: {
    getaxios(content,payload) {
      console.log(content);
      getlink(payload).then((ok) => {
        content.commit('getdata', {num: ok.data})
      });
    }
  },
  modules: {
  }
})
